package com.kool.kadmin.common.intercept;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: luyu
 * @create: 2019/02/02 13:34
 */
@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {
    @Resource
    private GlobalInterceptor globalInterceptor;

    @Value("${common.intercept.exclude_url}")
    List<String> excludeUrl;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(globalInterceptor).addPathPatterns("/**").excludePathPatterns(excludeUrl);
    }

}
